<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>抢课提交系统</title>
    <script src="https://cdn.bootcss.com/jquery/3.4.1/jquery.js"></script>
    <link href="https://cdn.bootcdn.net/ajax/libs/twitter-bootstrap/3.4.0/css/bootstrap.css" rel="stylesheet">
    <script src="https://cdn.bootcdn.net/ajax/libs/twitter-bootstrap/3.4.0/js/bootstrap.min.js"></script>
    <style>
        label {
            font-size: 38px;
            font-weight: lighter;
        }

        input {
            height: 52px;
        }
    </style>
</head>
<body>
<div>
    <br>
    <br>
    <form class="form-horizontal">
        <div class="form-group">
            <label for="id" class="col-sm-2 control-label">学号：</label>
            <div class="col-sm-8">
                <input class="form-control  input-lg" id="id" type="number" required>
            </div>
        </div>
        <br>
        <div class="form-group">
            <label for="password" class="col-sm-2 control-label">密码：</label>
            <div class="col-sm-8">
                <input class="form-control  input-lg" id="password" type="text" required>
            </div>
        </div>
        <br>
        <div class="form-group">
            <label for="course1" class="col-sm-2 control-label">第一门</label>
            <div class="col-sm-8">
                <input class="form-control  input-lg" id="course1" type="text" required>
            </div>
        </div>
        <br>
        <div class="form-group">
            <label for="course2" class="col-sm-2 control-label">第二门</label>
            <div class="col-sm-8">
                <input class="form-control  input-lg" id="course2" type="text">
            </div>
        </div>
        <br>
        <div class="form-group">
            <div class="col-sm-offset-2 col-sm-10">
                <div class="radio">
                    <label class="col-sm-offset-2 control-label " style="font-weight: lighter">
                        <input type="radio" style="width:50px;height:50px" style="" name="radio" value="1"
                               onclick="getValue(this)">&nbsp; &nbsp;抢一门
                    </label>
                    <label class="col-sm-offset-3  control-label" style="font-weight: lighter">
                        <input type="radio" style="width:50px;height:50px" name="radio" value="2"
                               onclick="getValue(this)">&nbsp; &nbsp;抢两门
                    </label>
                </div>
            </div>
        </div>
        <br>
        <div class="form-group">
            <div class="col-sm-offset-3 col-sm-6">
                <button type="button" class="btn btn-primary btn-lg btn-block" onclick="showAdress()">提交</button>
            </div>
        </div>
    </form>
</div>

<script type="text/javascript">
    var count

    function getValue(obj) {
        count = obj.value;
    }

    function showAdress() {
        var id = document.getElementById("id").value;
        var password = document.getElementById("password").value;
        var course1 = document.getElementById("course1").value;
        var course2 = document.getElementById("course2").value;
        $.ajax
        ({
            url: "/student/add",
            type: "get",
            data: {
                id: id,
                password: password,
                count: count,
                course1: course1,
                course2: course2
            },
            success: function (res) {
                if (res.code == 1) {
                    alert(res.data);
                }
                if (res.code == 0) {
                    alert(res.msg);
                }
                console.log(res);
            }
        });
    }
</script>
</body>
</html>